<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册 - 学生信息管理系统</title>
    <style>
        :root {
            --primary-color: #4361ee;
            --secondary-color: #3f37c9;
            --error-color: #f72585;
            --light-color: #f8f9fa;
            --dark-color: #212529;
            --success-color: #4cc9f0;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .register-container {
            width: 100%;
            max-width: 500px;
            background: white;
            padding: 2.5rem;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            animation: fadeIn 0.5s ease-in-out;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .logo {
            text-align: center;
            margin-bottom: 1.5rem;
        }

        .logo img {
            height: 60px;
        }

        .logo h1 {
            color: var(--primary-color);
            margin-top: 0.5rem;
            font-size: 1.5rem;
            font-weight: 600;
        }

        .form-group {
            margin-bottom: 1.25rem;
            position: relative;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--dark-color);
            font-weight: 500;
            font-size: 0.9rem;
        }

        .form-group input {
            width: 100%;
            padding: 0.75rem 1rem;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        .form-group input:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
            outline: none;
        }

        .form-group .input-icon {
            position: absolute;
            right: 1rem;
            top: 2.4rem;
            color: #adb5bd;
        }

        .register-btn {
            width: 100%;
            padding: 0.75rem;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .register-btn:hover {
            background-color: var(--secondary-color);
        }

        .error-message {
            color: var(--error-color);
            text-align: center;
            margin: 1rem 0;
            font-size: 0.9rem;
            animation: shake 0.5s;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-5px); }
            75% { transform: translateX(5px); }
        }

        .footer {
            text-align: center;
            margin-top: 1.5rem;
            color: #6c757d;
            font-size: 0.8rem;
        }

        .login-link {
            text-align: center;
            margin-top: 1rem;
        }

        .login-link a {
            color: var(--primary-color);
            text-decoration: none;
        }

        .login-link a:hover {
            text-decoration: underline;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
<div class="register-container">
    <div class="logo">
        <i class="fas fa-graduation-cap" style="font-size: 3rem; color: var(--primary-color);"></i>
        <h1>学生信息管理系统</h1>
    </div>

    <form action="${pageContext.request.contextPath}/user/register" method="post">
        <div class="form-group">
            <label for="username">用户名</label>
            <input type="text" id="username" name="username" placeholder="请输入用户名" required>
            <i class="fas fa-user input-icon"></i>
        </div>

        <div class="form-group">
            <label for="password">密码</label>
            <input type="password" id="password" name="password" placeholder="请输入密码" required>
            <i class="fas fa-lock input-icon"></i>
        </div>

        <div class="form-group">
            <label for="name">姓名</label>
            <input type="text" id="name" name="name" placeholder="请输入真实姓名" required>
            <i class="fas fa-id-card input-icon"></i>
        </div>

        <div class="form-group">
            <label for="email">邮箱</label>
            <input type="email" id="email" name="email" placeholder="请输入邮箱" required>
            <i class="fas fa-envelope input-icon"></i>
        </div>

        <div class="form-group">
            <label for="phone">电话</label>
            <input type="text" id="phone" name="phone" placeholder="请输入电话号码">
            <i class="fas fa-phone input-icon"></i>
        </div>

        <div class="form-group">
            <label for="department">院系</label>
            <input type="text" id="department" name="department" placeholder="请输入所在院系" required>
            <i class="fas fa-building input-icon"></i>
        </div>

        <c:if test="${param.error == 'true'}">
            <div class="error-message">
                <i class="fas fa-exclamation-circle"></i> 注册失败，请重试!
            </div>
        </c:if>

        <button type="submit" class="register-btn">注册</button>
    </form>

    <div class="login-link">
        已有账号? <a href="/index.jsp">立即登录</a>
    </div>

    <div class="footer">
        <p>© 2023 学生信息管理系统 | 版本 2.0</p>
    </div>
</div>
</body>
</html>
